import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import WindiCSS from 'vite-plugin-windicss'
import * as path from 'path'

export default defineConfig({
  plugins: [
    vue(),
    WindiCSS(),
  ],
  //配置跨域
  server: {
    open: true,  //启动项目后打开浏览器
    port: 88,
    proxy: {
      '/api': {
        target: 'http://localhost:9998',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  },
  // @别名
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  define: {
    // 明确定义并注入特性标志,以便在生产包中获得更好的树摇晃（tree-shaking）效果
    __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false, // 或者 true，根据你的需求设置
  },
})
